package ben.samplegame.sprite;

import java.awt.Image;
import java.awt.Point;
import java.awt.Shape;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import javax.imageio.ImageIO;
import ben.samplegame.collision.BulletCollsionBehavior;
import game.physics.GameVector;
import game.sprite.MovableSprite;
import game.sprite.collision.CollisionBehavior;
import game.sprite.collision.ICollidable;

public class SampleBullet extends MovableSprite implements ICollidable {

    private final String STANDARD_STATE = "standard_state";
    private CollisionBehavior myCollisionBehavior;

    public SampleBullet (Point startLocation, String spriteSet, boolean isActive) {
        super(startLocation, spriteSet, isActive);
        myCollisionBehavior = new BulletCollsionBehavior(this);
        HashMap<String, Image> tempSpriteSet = new HashMap<String, Image>();
        Image testImage = null;
        try {
            testImage = ImageIO.read(new File("src/ben/samplegame/resources/bullet.png"));

        } catch (IOException e) {
        }
        tempSpriteSet.put(STANDARD_STATE, testImage);
        setSpriteSet(tempSpriteSet);
        setActiveImage(STANDARD_STATE);
        setCenterCoordinate(startLocation);
        resize(.2);
    }

    @Override
    public void applyFriction () {
        

    }


    @Override
    public void update () {
        move();

    }

    @Override
    public void applyForce (GameVector force) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public Shape getOutline () {
        return getBounds();
    }

    @Override
    public CollisionBehavior getCollisionBehavior () {
        
        return myCollisionBehavior;
    }

    @Override
    public void setCollisionBehavior (CollisionBehavior collisionBehavior) {
        myCollisionBehavior = collisionBehavior;
        
    }

    @Override
    public void accept (ICollidable collidable) {
        collidable.getCollisionBehavior().visit(this);
      
        
    }

}
